<!DOCTYPE html>
<html>

<head th:include="cultivateWeb/header :: culHeaderCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<link type="text/css" href="/css/cultivateWeb/style/my.css" rel="stylesheet">

<body th:if="${resume!=''}">
    <!-- 顶部导航 -->
    <header th:include="cultivateWeb/header :: header"></header>
    <div style="clear: both"></div>
    <div style="background-color: #f7f7f7; ">
        <div style="height: 40px">
            <p style="margin: 0px auto auto 380px; line-height: 40px">当前位置：<a href="/cultivate/homepage">首页</a> > 个人信息
            </p>
        </div>
        <hr style="margin:0 auto  ; width: 1200px" />
        <div id="edit">
            <div style="clear: both; margin-bottom: 20px"></div>
            <section class="sec_1" style="background:#F7F7F7;padding-top: 0">
                <div class="div_1">
                    <ul>
                        <li><a href="/certificate/my">个人信息</a></li>
                        <li class="this" onclick="recruit()"><a>我的简历</a></li>
                        <!-- <li><a href="/certificate/findApplyExam">报名记录</a></li> -->
                        <li><a href="/certificate/infoRecordList">表单提交记录</a></li>
                        <li><a href="/certificate/expertRecordList">专家申请记录</a></li>
                        <li><a href="/certificate/stationRecordList">考核站点申请记录</a></li>
                        <li><a href="/certificate/stationPxRecordList">培训基地申请记录</a></li>
                        <li><a href="/certificate/gradeQuery">成绩查询</a></li>
                        <li><a href="/certificate/message">消息中心</a></li>
                        <li onclick="mock2(this)" data-type="2"><a>幼儿照护初级模拟考试</a></li>
                        <li onclick="mock2(this)" data-type="1"><a>幼儿照护中级模拟考试</a></li>
                        <li onclick="mock2(this)" data-type="0"><a>幼儿照护高级模拟考试</a></li>
                    </ul>
                </div>
                <div class="div_2" id="info" style="padding: 10px">
                </div>
                <div style="clear: both;"></div>
            </section>
        </div>

        <div style="margin-bottom: 50px;display: inline-block"></div>
        <!-- 分页 -->
    </div>
    <!-- footer ------------------------------------------------------- -->
    <div class="footer" th:include="cultivateWeb/header :: footer"></div>
</body>
<script src="//s.xlongwei.com/res/js/My97DatePicker/WdatePicker.js"></script>
<script src="/js/layui/lay/modules/layer.js"></script>
<script src="/js/layui/layui.js"></script>
<script type="text/javascript" src="/js/mobile.js"></script>
<script>
    function save() {
        var workYears = $("#workYears").val();
        var nativePlace = $("#nativePlace").val();
        var desiredOccupation = $('#desiredOccupation').val();
        var applyState = $("#applyState").val();
        var graduatedFrom = $("#graduatedFrom").val();
        var expectedSalary = $("#expectedSalary").val();
        var jobAddress = $('#jobAddress').val();
        var selfEvaluation = $("#selfEvaluation").val();
        var isPush = $('#isPush').val();
        var jobNature = $("#jobNature").val();
        var skills = $('#skills').val();

        /*if(workYears=='' || nativePlace==''||desiredOccupation==''||applyState==''||graduatedFrom=='' ||
            expectedSalary == '' || jobAddress == '' || selfEvaluation == '' || isPush == '' ||
            jobNature == '' || skills == ''){
            layer.msg("基本信息不能为空");
            return false
        }*/
        if (workYears == '') {
            layer.msg("工作年限不能为空");
            return false
        }
        if (nativePlace == '') {
            layer.msg("籍贯不能为空");
            return false
        }
        if (desiredOccupation == '') {
            layer.msg("期望职业不能为空");
            return false
        }
        if (applyState == '') {
            layer.msg("求职状态不能为空");
            return false
        }
        if (graduatedFrom == '') {
            layer.msg("毕业学校不能为空");
            return false
        }
        if (expectedSalary == '') {
            layer.msg("期望薪资不能为空");
            return false
        }
        if (jobAddress == '') {
            layer.msg("工作地点不能为空");
            return false
        }
        if (selfEvaluation == ''|| selfEvaluation.length<50) {
            layer.msg("自我评价不能为空");
            return false
        }
        if (isPush == '') {
            layer.msg("是否推送不能为空");
            return false
        }
        if (jobNature == '') {
            layer.msg("工作性质不能为空");
            return false
        }
        if (skills == ''|| skills.length<50) {
            layer.msg("专业技能不能为空");
            return false
        }

        //------------------------教育经历---------------------------//
        var jyjlList = [];
        var jyjl = true;
        $(".jyjl").each(function (item, index) {
            var rxTime = $(this).find(".rxTime").val();
            var byTime = $(this).find(".byTime").val();
            var bySchool = $(this).find('.bySchool').val();
            var s = rxTime.substr(0, 4)
            var f = byTime.substr(0, 4)
            var t = f - s
            if (rxTime == '' || byTime == '' || bySchool == '' || t < 2 && t < '2') {
                layer.msg('请检查教育经历是否填写正确');
                jyjl = false;
            }
            jyjlList.push({ rxTime: rxTime, byTime: byTime, bySchool: bySchool });
        })

        // console.log("jyjlList == " , jyjlList);
        if (jyjl == false) {
            return jyjl;
        }
        //---------------------------工作经历---------------------------//
        var gzjlList = [];
        var gzjl = true;
        $(".gzjl").each(function (item, index) {
            var rzTime = $(this).find(".rzTime").val();
            var lzTime = $(this).find(".lzTime").val();
            var gsName = $(this).find('.gsName').val();
            var zwName = $(this).find('.zwName').val();
            var xsNum = $(this).find('.xsNum').val();
            var zwDescribe = $(this).find('.zwDescribe').val();
            // if(rzTime=='' || lzTime == '' || gsName == '' || zwName == '' || xsNum == '' || zwDescribe == ''){
            //     layer.msg('工作经历填写不完整');
            //     gzjl = false;
            // }
            gzjlList.push({ rzTime: rzTime, lzTime: lzTime, gsName: gsName, zwName: zwName, xsNum: xsNum, zwDescribe: zwDescribe });
        })
        if (gzjl == false) {
            return gzjl;
        }

        //---------------------------项目经验---------------------------//
        var xmjyList = [];
        var xmjy = true;
        $(".xmjy").each(function (item, index) {
            var xmStartTime = $(this).find(".xmStartTime").val();
            var xmEndTime = $(this).find(".xmEndTime").val();
            var xmName = $(this).find('.xmName').val();
            var xmDescribe = $(this).find('.xmDescribe').val();
            // if(xmStartTime=='' || xmEndTime == '' || xmName == '' || xmDescribe == ''){
            //     layer.msg('项目经验填写不完整');
            //     xmjy = false;
            // }
            xmjyList.push({ xmStartTime: xmStartTime, xmEndTime: xmEndTime, xmName: xmName, xmDescribe: xmDescribe });
        })
        if (xmjy == false) {
            return xmjy;
        }

        //---------------------------荣获证书---------------------------//
        var rhzsList = [];
        var rhzs = true;
        $(".rhzs").each(function (item, index) {
            var zsName = $(this).find(".zsName").val();
            var zsTime = $(this).find(".zsTime").val();
            // if(zsName=='' || zsTime == ''){
            //     layer.msg('荣获证书填写不完整');
            //     rhzs = false;
            // }
            rhzsList.push({ zsName: zsName, zsTime: zsTime });
        })
        if (rhzs == false) {
            return rhzs;
        }
        // console.log("workYears",workYears)
        ajaxToken("/jzApi/recruitment/updResume", "POST",
            {
                workYears: workYears,
                nativePlace: nativePlace,
                graduatedFrom: graduatedFrom,
                desiredOccupation: desiredOccupation,
                expectedSalary: expectedSalary,
                applyState: applyState,
                jobAddress: jobAddress,
                isPush: isPush,
                jobNature: jobNature,
                skills: skills,
                selfEvaluation: selfEvaluation,
                educationExperience: JSON.stringify(jyjlList),
                workExperience: JSON.stringify(gzjlList),
                project: JSON.stringify(xmjyList),
                certificate: JSON.stringify(rhzsList)
            }, function (res) {
                location.href = '/cultivate/myResume';
            })
    }

    /*function btn1() {

        console.log("del = " , $(this).html())
        $(this).attr('.del').parent('.jyjl').remove()
    }*/

    $(function () {
        ajaxToken("/jzApi/recruitment/selResume", "GET", {}, function (res) {
            //------------------教育经历---------------------//
            var edu = JSON.parse(res.educationExperience);
            var jyjl = '';
            edu.forEach(function (item, index) {
                jyjl += '<div style="margin-top:20px" class="jyjl">' +
                    '<span class="jl_sclTime">' +
                    '<input value="' + item.rxTime + '" onclick="WdatePicker({dateFmt:\'yyyy-MM\'})" type="text" class="jl_ipt rxTime" id="start" placeholder="入学时间"/>- &nbsp;&nbsp;' +
                    '<input value="' + item.byTime + '" onclick="WdatePicker({dateFmt:\'yyyy-MM\'})" type="text" class="jl_ipt byTime" id="finish" placeholder="毕业时间"/>' +
                    '</span>' +
                    '<span class="jl_school">' +
                    '<input value="' + item.bySchool + '" type="text" class="jl_ipt bySchool" placeholder="请输入学校名" />' +
                    '</span>' +
                    // '<span class="del" id="del">删除</span>'+
                    '</div>';
            })

            //------------------工作经历---------------------//
            var work = JSON.parse(res.workExperience);
            var gzjl = '';
            work.forEach(function (item, index) {
                gzjl += '<div style="margin-top:20px" class="gzjl">' +
                    '<span class="jl_sclYear">' +
                    '<input type="text" value="' + item.rzTime + '" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt rzTime" placeholder="开始时间"/>- &nbsp;&nbsp;' +
                    '<input type="text" value="' + item.lzTime + '" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt lzTime" placeholder="结束时间"/>' +
                    '</span>' +
                    '<span class="jl_gs">' +
                    '<input type="text" value="' + item.gsName + '" style="width: 300px" class="jl_ipt gsName" placeholder="公司名" /></span>' +
                    '<span class="jl_zw">' +
                    '职位：<input type="text" value="' + item.zwName + '" class="jl_ipt zwName" placeholder="职位名" /> &nbsp;&nbsp;' +
                    '薪资：<input type="text" value="' + item.xsNum + '" class="jl_ipt xsNum" placeholder="薪资" />/月</span>' +
                    '<span class="jl_ms">' +
                    '<textarea class="jl_tarea zwDescribe" placeholder="职位描述" maxlength="800">' + item.zwDescribe + '</textarea>' +
                    '</span>' +
                    '</div>';
            })

            //------------------项目经验---------------------//
            var pro = JSON.parse(res.project);
            var xmjy = '';
            pro.forEach(function (item, index) {
                xmjy += '<div style="margin-top:20px" class="xmjy">' +
                    '<span class="jl_sclYear">' +
                    '<input type="text" value="' + item.xmStartTime + '" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt xmStartTime" placeholder="开始时间"/>- &nbsp;&nbsp;' +
                    '<input type="text" value="' + item.xmEndTime + '" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt xmEndTime" placeholder="结束时间"/>' +
                    '</span>' +
                    '<span class="jl_gs"><input value="' + item.xmName + '" type="text" class="jl_ipt xmName" style="width: 300px" placeholder="项目名" /></span>' +
                    '<span class="jl_ms">' +
                    '<textarea class="jl_tarea xmDescribe" placeholder="项目描述" maxlength="800">' + item.xmDescribe + '</textarea>' +
                    '</span>' +
                    '</div>';
            })

            //------------------荣获证书---------------------//
            var cer = JSON.parse(res.certificate);
            var rhzs = '';
            cer.forEach(function (item, index) {
                rhzs += '<div style="margin-top:20px;width: 100%" class="rhzs">' +
                    '<span class="jl_zs"><input value="' + item.zsName + '"  type="text" class="jl_ipt zsName" style="width: 300px" placeholder="证书名" /></span>' +
                    '<span class="jl_date"><input value="' + item.zsTime + '" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" type="text" class="jl_ipt zsTime" placeholder="获得年月" /></span>' +
                    '</div>';
            })

            var info = '';
            info = '<div style="width:940px; margin: 40px auto 20px auto">' +
                '                    <span style="float: right;margin-right: 20px; margin-bottom: 30px">' +
                '                         <label style="color: #666">注：部分信息需要到个人资料去修改</label>' +
                '                        <input class="edit" type="button" onclick="save();" value="保存"/>&nbsp;&nbsp;&nbsp;' +
                '                    </span>' +
                '                </div>' +
                '                <div class="jl_1">' +
                '                <div class="jl_2" style="width: 100%">' +
                '                    <span style="width: 920px;display:inline-block"><img src="' + res.headPortrait + '" class="jl_img"></span>' +
                '                    <span class="jl_name">' + res.userName + '</span>' +
                '                    </div>' +
                '                </div><div style="clear: both"></div>' +
                '                <div class="jl_xx">' +
                '                    <span class="jl_xx_1">个人信息</span><hr class="jl_hr" />' +
                '                    <div style="margin-top:15px">' +
                '                        <span class="jl_xx_2">籍&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;贯：' +
                '                            <input class="jl_ipt" name="nativePlace" value="' + res.nativePlace + '" style="height: 40px;width: 225px" type="text" id="nativePlace"/>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">毕业学校：' +
                '                            <input class="jl_ipt" name="graduatedFrom" value="' + res.graduatedFrom + '" style="height: 40px;width: 225px" type="text" id="graduatedFrom"/>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">期望职业：' +
                '                            <input class="jl_ipt" name="desiredOccupation" value="' + res.desiredOccupation + '" style="height: 40px;width: 225px" type="text" id="desiredOccupation"/>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">期望薪资：' +
                '                            <input type="hidden" id="expectedSalary1" value="' + res.expectedSalary + '" />' +
                '                               <select name="expectedSalary" id="expectedSalary"  class="jl_ipt">' +
                '                               <option value="1000-3000元">1000-3000元</option>' +
                '                                <option value="3000-5000元">3000-5000元</option>' +
                '                                <option value="5000-8000元">5000-8000元</option>' +
                '                                 <option value="8000-10000元">8000-10000元</option>' +
                '                                 <option value="10000-20000元">10000-20000元</option>' +
                '                                 <option value="20000元以上">20000元以上</option>' +
                '                            </select>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">工作年限：' +
                '                            <input class="jl_ipt" style="height: 40px;width: 225px" value="' + res.workYears + '" id="workYears" type="text"/>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">工作性质：' +
                '                        <input type="hidden" id="jobNature1" value="' + res.jobNature + '" />' +
                '                            <select name="jobNature" id="jobNature" class="jl_ipt">' +
                '                                <option value="0">全职</option>' +
                '                                <option value="1">兼职</option>' +
                '                                <option value="2">实习</option>' +
                '                            </select>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">求职状态：' +
                '                            <input type="hidden" id="applyState1" value="' + res.applyState + '" />' +
                '                            <select name="applyState" id="applyState" class="jl_ipt">' +
                '                               <option value="0">立即到岗</option>' +
                '                               <option value="1">月内到岗</option>' +
                '                               <option value="2">考虑机会</option>' +
                '                               <option value="3">暂不考虑</option>' +
                '                            </select>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">工作地点：' +
                '                            <input class="jl_ipt" name="jobAddress" value="' + res.jobAddress + '" style="height: 40px;width: 225px" type="text" id="jobAddress"/>' +
                '                        </span>' +
                '                        <span class="jl_xx_2">是否推送：' +
                '                            <input type="hidden" id="isPush1" value="' + res.isPush + '" />' +
                '                            <select id="isPush" class="jl_ipt">' +
                '                               <option value="0">否</option>' +
                '                               <option value="1">是</option>' +
                '                            </select>' +
                '                        </span>' +
                '                    </div>' +
                '                </div>' +
                '                <div>' +
                '                    <span class="jl_xx_1">教育经历</span><hr class="jl_hr" />' +
                '                    <div id="box">' + jyjl + '</div>' +
                '                    <div style="text-align: center">' +
                '                        <p><input type="button" onclick="insert()" class="insert" value="新增教育经历" /></p>' +
                '                    </div>' +
                '                </div>' +
                '                <div>' +
                '                    <span class="jl_xx_1">工作经历</span><hr class="jl_hr" />' +
                '                    <div id="gzjl">' + gzjl + '</div>' +
                '                    <div style="text-align: center">' +
                '                        <p><input type="button" onclick="insert1()" class="insert" value="新增工作经历" /></p>' +
                '                    </div>' +
                '                </div>' +
                '                <div>' +
                '                    <span class="jl_xx_1">项目经验</span><hr class="jl_hr" />' +
                '                    <div id="xmjy">' + xmjy + '</div>' +
                '                    <div style="text-align: center">' +
                '                        <p><input type="button" onclick="insert2()" class="insert" value="新增项目经验" /></p>' +
                '                    </div>' +
                '                </div>' +
                '                <div>' +
                '                    <span class="jl_xx_1">荣获证书</span><hr class="jl_hr" />' +
                '                    <div id="rhzs">' + rhzs + '</div>' +
                '                    <div style="text-align: center">' +
                '                        <p><input type="button" onclick="insert3()" class="insert" value="新增荣获证书" /></p>' +
                '                    </div>' +
                '                </div>' +
                '                <div style="margin-bottom: 70px">' +
                '                    <span class="jl_xx_1">专业技能</span><hr class="jl_hr" />' +
                '                    <div style="margin-top:20px">' +
                '                        <span class="jl_ms">' +
                '                            <textarea class="jl_tarea"  id="skills" placeholder="专业技能描述（限500字以内）" maxlength="500">' + res.skills + '</textarea>' +
                '                        </span>' +
                '                    </div>' +
                '                </div>' +
                '                <div style="margin-bottom: 140px">' +
                '                    <span class="jl_xx_1">自我评价</span><hr class="jl_hr" />' +
                '                    <div style="margin-top:20px">' +
                '                        <span class="jl_ms">' +
                '                            <textarea class="jl_tarea"  id="selfEvaluation" placeholder="自我评价（限500字以内）" maxlength="500">' + res.selfEvaluation + '</textarea>' +
                '                        </span>' +
                '                    </div>' +
                '                </div>' +
                '<div style="margin-bottom:30px;text-align: center"><input class="edits" onclick="save();" type="button" value="保存"/>&nbsp;&nbsp;&nbsp;</div>';

            $('#info').html(info)
            $('#expectedSalary').val($('#expectedSalary1').val())
            $('#jobNature').val($('#jobNature1').val())
            $('#applyState').val($('#applyState1').val())
            $('#isPush').val($('#isPush1').val())
        })
    })

    function insert() {
        $('#box').append('<div style="margin-top:20px" class="jyjl">' +
            '                        <span class="jl_sclTime">' +
            '                            <input type="text" class="jl_ipt rxTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="入学时间"/>- &nbsp;&nbsp;' +
            '                            <input type="text" class="jl_ipt byTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="毕业时间"/>' +
            '                        </span>' +
            '                        <span class="jl_school"><input type="text" class="jl_ipt bySchool" placeholder="请输入学校名" /></span>' +
            '                        <span class="del" id="del">删除</span>' +
            '                    </div>');

        $('.del').click(function () {
            $(this).parent('.jyjl').remove()
        })
    }
    function insert1() {
        $('#gzjl').append('<div style="margin-top:20px" class="gzjl">' +
            '                        <span class="jl_sclYear">' +
            '                            <input type="text" class="jl_ipt rzTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="开始时间"/>- &nbsp;&nbsp;' +
            '                            <input type="text" class="jl_ipt lzTime" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" placeholder="结束时间"/>' +
            '                            <span class="del">删除</span>' +
            '                        </span>' +
            '                        <span class="jl_gs"><input type="text" style="width: 300px" class="jl_ipt gsName" placeholder="公司名" /></span>' +
            '                        <span class="jl_zw">' +
            '                            职位：<input type="text" class="jl_ipt zwName" placeholder="职位名" /> &nbsp;&nbsp;' +
            '                            薪资：<input type="text" class="jl_ipt xsNum" placeholder="薪资" />/月</span>' +
            '                        <span class="jl_ms">' +
            '                            <textarea class="jl_tarea zwDescribe" placeholder="职位描述" maxlength="800"></textarea>' +
            '                        </span>' +
            '                    </div>');

        $('.del').click(function () {
            $(this).parent('.jl_sclYear').parent('.gzjl').remove()
        })
    }

    function insert2() {
        $('#xmjy').append('<div style="margin-top:20px" class="xmjy">' +
            '                        <span class="jl_sclYear">' +
            '                            <input type="text" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt xmStartTime" placeholder="开始时间"/>- &nbsp;&nbsp;' +
            '                            <input type="text" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt xmEndTime" placeholder="结束时间"/>' +
            '                            <span class="del">删除</span>' +
            '                        </span>' +
            '                        <span class="jl_gs"><input type="text" class="jl_ipt xmName" style="width: 300px" placeholder="项目名" /></span>' +
            '                        <span class="jl_ms">' +
            '                            <textarea class="jl_tarea xmDes cribe" placeholder="项目描述" maxlength="800"></textarea>' +
            '                        </span>' +
            '                    </div>');

        $('.del').click(function () {
            $(this).parent('.jl_sclYear').parent('.xmjy').remove()
        })
    }

    function insert3() {
        $('#rhzs').append('<div style="margin-top:20px;width: 100%" class="rhzs">' +
            '                        <span class="jl_zs"><input type="text" class="jl_ipt zsName" style="width: 300px" placeholder="证书名" /></span>' +
            '                        <span class="jl_date"><input type="text" onclick="WdatePicker({dateFmt:\'yyyy年MM月\'})" class="jl_ipt zsTime" placeholder="获得年月" /></span>' +
            '                        <span class="del">删除</span>' +
            '                    </div>');

        $('.del').click(function () {
            $(this).parent('.rhzs').remove()
        })
    }

</script>

</html>